package com.wlyy.bcwlw.sys.config.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.directwebremoting.annotations.RemoteProxy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.wlyy.bcwlw.base.BaseController;
import com.wlyy.bcwlw.sys.config.dao.SysConfigDAO;
import com.wlyy.bcwlw.sys.config.entity.SysConfigDTO;
import com.wlyy.bcwlw.sys.config.service.SysConfigService;


@RemoteProxy
@Controller
@RequestMapping("/sys/config")
public class SysConfigController extends BaseController{
	@Autowired
	private SysConfigDAO sysConfingDAO;
	@Autowired
	private SysConfigService sysConfigService;

	@RequestMapping("/view")
	public String configView(HttpServletRequest request,HttpServletResponse response){
		return "sys/config/config-view";
	}
	
	
	@RequestMapping("/list")
	public String configList(HttpServletRequest request,HttpServletResponse response) throws Exception{
		int curPage = getPageNum(request);
		int limit = getInternal(request);
		
		List<SysConfigDTO> list = sysConfingDAO.queryByObject(null);
		
		int count = list.size();
		
		processJsonData4Grid(request, response, limit, curPage, count, list);
		
		return null;
	}
	
	public boolean saveConfigInfo(SysConfigDTO sysConfigDTO){
		return sysConfigService.saveConfigInfo(sysConfigDTO);
	}
	
	public boolean removeConfigInfoById(String ConfigId){
		return sysConfigService.removeConfigInfoById(ConfigId);
	}
}
